SQLException:[Microsoft][ODBC SQL Server Driver][SQL Server]对象名 'usemen' 无效。

来源:百度知道 编辑:UC知道 时间:2024/09/25 21:25:41
import java.awt.*;
import java.awt.event.*;
import java.sql.*;
public class Login_1 extends Frame implements ActionListener{
String url="jdbc:odbc:text";
Connection con;
String sql;
// String x=null;
Statement stmt;
TextField UserName = new TextField(15);
TextField Pass = new TextField(15);
Button ok = new Button("登陆");
Button cancel = new Button("取消");
public Login_1(){
addWindowListener(new WindowAdapter(){
public void windowClosing(WindowEvent e){
System.exit(0);
}
});
Color c1=new Color(241,250,250);
Color c2=new Color(200,239,250);
// Color c3=new Color(150,220,250);
setLayout(new GridLayout(4,0));
Panel panel1 = new Panel();
Label x=new Label("欢迎登陆工资管理系统");
x.setFont(new Font("SansSerif",Font.BOLD|Font.ITALIC,20));
panel1.add(x);
add(panel1);

select * from usemen where 用户='"+UserName+"'"+"and 密码='"+Pass+"'";
这句报的错,检查数据库设置的对不对,有没有一张表叫做usemen
可能性有两个,一个是数据库连接池是错的,比如应该master库,结果连在northwind了
一个是数据表本身不存在。

如果你实在搞不清楚,表名前加说明好了
比如master.dbo.usemen ,如果能够找到表,是什么问题不就一目了然了。